def length(xs:List[Int]):Int= xs match {
    case Nil=>0
    case y::ys=> 1+length(ys)     
}
val l=List.range(10,56)
println(length(l))
println(l)

val l1=List.range(1,10)
val l2=List.range(5,15)

println(l1 ::: l2)
def reverse(xs:List[Int]):List[Int]= xs match {
   case Nil=>Nil
   case y::ys=>reverse(ys) ::: List(y)     
} 

println(reverse(l1))
println(reverse(l2))
def mulby2(xs:List[Int]):List[Int]= xs match{
    case Nil=>Nil
    case y::ys=> 2*y :: mulby2(ys)    
}

println(mulby2(l1))


def mulby3(xs:List[Int]):List[Int]= xs match{
    case Nil=>Nil
    case y::ys=> 3*y :: mulby3(ys)    
}
println(mulby3(l1))


def myMap(xs:List[Int],fn:(Int)=>Int):List[Int]= xs match {
    case Nil=>Nil
    case y::ys=> fn(y) :: myMap(ys,fn)   
}

def m2(x:Int)=x*2
def m3(x:Int)=x*3

println(myMap(l1,m3))

val powerof2L1 = myMap(l1, (x) => x * x)
println(powerof2L1)